﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPage/AdminMasterPage.master" AutoEventWireup="true" CodeFile="SAPFin002.aspx.cs" Inherits="Admin_SAPFin_SAPFin002" %>

<asp:Content ID="Content1" ContentPlaceHolderID="phScript" runat="Server">
    <script type="text/javascript" src="/Scripts/Controls/DatePicker/WdatePicker.js"></script>
    <script type="text/javascript">
        function PrintLabel() {
            var checkList = $(".pagnationtable input:checked");
            if (checkList.length > 8) {
                alert('选择的记录数不能超过8条。(当前选择：' + checkList.length + '条)');
                return;
            }
            if (checkList.length > 0) {
                var ids = "";
                checkList.each(function () {
                    ids += $(this).parent().attr("data-boxid") + ",";
                });

                OpenWindow('标签打印', 'P', '/Admin/SAPFin/SAPFin002P.aspx?type=P&boxids=' + ids, 1200, 740)
            }
            else {
                alert("请选择您要打印的凭证盒标签!");
            }
        }

        function giveLocation() {
            var checkList = $(".pagnationtable input:checked");

            if (checkList.length > 0) {

                checkList.each(function () {
                    if ($(this).parent().attr("data-boxno") == "") {
                        alert("存在未打印标签号的凭证盒，不能批量分配位置号！");
                        return false;

                    }
                    else {
                        var ids = "";
                        checkList.each(function () {
                            ids += $(this).parent().attr("data-boxid") + ",";
                        });

                        OpenWindow('分配仓库号', 'P', '/Admin/SAPFin/SAPFin002f.aspx?boxids=' + ids, 600, 500)

                    }
                });


            }
            else {
                alert("请选择您要分配仓库号的凭证盒标签!");
            }
        }

        function Location(ids, boxNo) {
            if (boxNo == "") {
                alert("必须先打印标签号后才能分配位置号");
            }
            else {
                OpenWindow('分配仓库号', 'P', '/Admin/SAPFin/SAPFin002f.aspx?boxids=' + ids + ",", 600, 500);
            }
            return false;
        }




        $(function () {
            $("span").each(function () {
                if ($(this).attr("data-recount") == '0') {
                    $(this).find("input").hide();
                }
            });
        });

        function searchDiv() {
            $("#tbSearch").toggle("fast");
            if ($("#divButton").hasClass("open")) {
                $("#divButton").removeClass("open");
                $("#divButton").addClass("close")
            }
            else {
                $("#divButton").removeClass("close");
                $("#divButton").addClass("open")
            }

        }
        function batUpdate() {
            var selIds = "";
            $(".sel_first>input[type='checkbox']").each(function () {
                if ($(this).is(":checked")) {
                    selIds += $(this).prev().val() + ",";
                }
            });
            if (selIds.length == 0) {
                alert("请选择您要批量修改的凭证!");
            } else {
                OpenWindow("凭证批量修改", "B", "/Admin/SAPFin/SAPFin002a.aspx?type=B&BoxID=" + selIds, 600, 500);
            }
            return false;
        }

        function eidtBox(Id) {
            if (Id == "")
            { javascript: OpenWindow('新增', 'A', '/Admin/SAPFin/SAPFin002a.aspx?', 600, 500) }
            else
            { javascript: OpenWindow('修改', 'A', '/Admin/SAPFin/SAPFin002a.aspx?BoxID=' + Id, 600, 500) }
            return false;
        }

        function deleteLink(id) {
            if (confirm('是否确定要删除此凭证盒？')) {
                OpenWindow('删除', 'U', '/Admin/SAPFin/SAPFin002g.aspx?Id=' + id, 1000, 680);
            }
            return false;
        }

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div style="width: 100%; min-width: 700px">
        <div class="searchBox">
            <div class="c">
                <div class="sb1">搜索条件</div>
                <div class="sb2 open" onclick="searchDiv()" id="divButton"></div>
            </div>
            <table cellspacing="2" cellpadding="2" id="tbSearch" style="display: none;" border="0">
                <tr>
                    <td width="100px">创建日期:
                    </td>
                    <td>
                        <span style="color: #000;">
                            <input class="Wdate textBox" style="width: 180px;" runat="server" readonly="readonly"
                                type="text" id="txtStartDate" clientidmode="Static" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'txtEndate\')||$dp.$DV(\'9998-12-31\')}'})" />&nbsp;&nbsp;至&nbsp;&nbsp;
                    <input class="Wdate textBox" runat="server" readonly="readonly" type="text" id="txtEndate"
                        clientidmode="Static" style="width: 180px;" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'txtStartDate\');}',maxDate:'9998-12-31'})" />
                        </span>

                    </td>
                    <td>文档日期:
                    </td>
                    <td>
                        <input class="Wdate textBox" runat="server" readonly="readonly" type="text" id="txtPostingStartDate"
                            clientidmode="Static" style="width: 180px;" onfocus="WdatePicker({dateFmt:'yyyy-MM'})" />
                        <input class="Wdate textBox" runat="server" readonly="readonly" type="text" id="txtPostingEndDate"
                            clientidmode="Static" style="width: 180px;" onfocus="WdatePicker({dateFmt:'yyyy-MM'})" />
                        <%--<yncWebDDL:DrpYear ID="drpYearStart" runat="server">
                            </yncWebDDL:DrpYear>
                            <yncWebDDL:DrpMonth ID="drpMonthStart" runat="server">
                            </yncWebDDL:DrpMonth>
                            -
                            <yncWebDDL:DrpYear ID="drpYearEnd" runat="server">
                            </yncWebDDL:DrpYear>
                            <yncWebDDL:DrpMonth ID="drpMonthEnd" runat="server">
                            </yncWebDDL:DrpMonth>--%>
                    </td>
                </tr>
                <tr>
                    <td>公司名称:
                    </td>
                    <td>
                        <yncWebDDL:DrpCompany ID="drpCompany" runat="server" ShowSelectedItem="true">
                        </yncWebDDL:DrpCompany>
                    </td>
                    <td>职能部门:
                    </td>
                    <td>
                        <yncWebDDL:DrpCodeTable ID="drpFunctionDept" runat="server" Category="CTE001" ShowSelectedItem="true">
                        </yncWebDDL:DrpCodeTable>
                    </td>
                </tr>
                <tr>
                    <td>实物存储状态:
                    </td>
                    <td>
                        <yncWebDDL:DropDownListBase ID="drpStoreStatus" runat="server">
                            <asp:ListItem Text="请选择" Value=""></asp:ListItem>
                            <asp:ListItem Text="新建" Value="S0"></asp:ListItem>
                            <asp:ListItem Text="待入库" Value="S88"></asp:ListItem>
                        </yncWebDDL:DropDownListBase>
                    </td>

                    <td>实物存储地点:
                    </td>
                    <td>
                        <yncWebDDL:DrpThirdUnit ID="drpLocation" runat="server" ShowSelectedItem="true" AutoPostBack="true" OnSelectedIndexChanged="drpLocation_OnSelectedIndexChanged">
                        </yncWebDDL:DrpThirdUnit>
                        <yncWebDDL:DropDownListBase ID="drpCabin" runat="server" AutoPostBack="true" OnSelectedIndexChanged="drpCabin_OnSelectedIndexChanged"></yncWebDDL:DropDownListBase>
                        <yncWebDDL:DropDownListBase ID="drpNumber" runat="server"></yncWebDDL:DropDownListBase>
                    </td>
                </tr>
                <tr>
                    <td>创建人:</td>
                    <td>
                        <yncWebDDL:DrpUsersLoginName ID="drpCreator" runat="server" ShowSelectedItem="true" /></td>
                    <td>文档描述:</td>
                    <td>
                        <yncWebDDL:DrpCodeTable ID="drpDocType" runat="server" Category="CTE006" ShowSelectedItem="true">
                        </yncWebDDL:DrpCodeTable>
                    </td>
                </tr>
                <tr>
                    <td>文档盒条形码:</td>
                    <td colspan="3">
                        <yncWeb:yncTextBox ID="txtBoxNoStart" runat="server"></yncWeb:yncTextBox>
                        -
                        <yncWeb:yncTextBox ID="txtBoxNoEnd" runat="server"></yncWeb:yncTextBox>
                    </td>
                </tr>
                <tr>
                    <td colspan="6"><span style="margin-left: 8px">
                        <asp:Button ID="btnSearch" runat="server" Text="搜索" OnClick="btnSearch_Click" /></span><br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                    </td>
                </tr>
                <tr>
                    <td>是否已经删除</td>
                    <td>
                        <yncWebDDL:DropDownListBase ID="drpIsDeleted" runat="server">
                            <asp:ListItem Text="全部" Value=""></asp:ListItem>
                            <asp:ListItem Text="未删除" Value="0" Selected="True"></asp:ListItem>
                            <asp:ListItem Text="已删除" Value="1"></asp:ListItem>
                        </yncWebDDL:DropDownListBase>
                    </td>
                    <td>是否修改</td>
                    <td>
                        <yncWebDDL:DropDownListBase ID="drpIsUpdate" runat="server">
                            <asp:ListItem Text="未修改" Value="" Selected="True"></asp:ListItem>
                            <asp:ListItem Text="已修改" Value="1"></asp:ListItem>
                        </yncWebDDL:DropDownListBase>
                    </td>
                </tr>
                <tr>
                    <td>应保管年限</td>

                </tr>
            </table>
        </div>
        <table width="100%" cellspacing="2" cellpadding="2" class="menu" align="left" style="margin-top: 10px;">
            <td style="width: 3px;">&nbsp;
            </td>
            <td class="td">
                <a class="add" onclick="eidtBox('')" href="#">新增凭证盒</a>
                <a class="print" onclick="PrintLabel()" href="#">标签打印</a>
                <a class="location" onclick="giveLocation()" href="#">分配仓库号</a>
                <a class="batch" onclick="batUpdate();" href="#">批量编辑</a>
            </td>
        </table>
        <yncWeb:PagnationGrid PageSize="30" ID="pageGrid" runat="server" OnOnPageIndexChange="PageChanged">
            <HeaderTemplate>
                <table width="1930px" cellspacing="0" cellpadding="0" class="pagnationtable" align="center">
                    <thead>
                        <tr>
                            <th width="40px">序号
                            </th>
                            <th width="80px" class="center">操作
                            </th>
                            <th width="120px">文档日期
                            </th>
                            <th width="110px">文档盒条形码
                            </th>
                            <th width="200px">凭证号起止
                            </th>
                            <th width="120px">文档描述
                            </th>
                            <th width="80px">公司名称
                            </th>
                            <th width="80px">公司代码
                            </th>
                            <th width="80px">职能部门
                            </th>
                            <th width="80px">凭证数量
                            </th>
                            <th width="90px">应保管期限
                            </th>
                            <th width="300px">实物存储地点
                            </th>
                            <th width="100px">实物存储状态
                            </th>
                            <th width="90px">文档管理员
                            </th>
                            <th width="180px">创建人/最后更新人
                            </th>
                            <th width="280px">创建时间/最后更新时间
                            </th>

                        </tr>
                    </thead>
                    <tbody>
            </HeaderTemplate>
            <ItemTemplate>
                <tr>
                    <td class="sel_first" style="text-align: right; padding-right: 5px;">
                        <asp:CheckBox ID="chk_sel" data-recount="<%# Business.getReceiptCount(Eval(FinReceiptMetadata.ColumnNames.BoxID)) %>" class="sel_class" runat="server" data-boxid="<%# Eval(FinReceiptMetadata.ColumnNames.BoxID) %>" data-boxno="<%# Eval(FinBoxMetadata.ColumnNames.BoxNo) %>" />
                        <asp:Label ID="lbBoxID" runat="server" Visible="false" Text="<%# Eval(FinReceiptMetadata.ColumnNames.BoxID) %>"></asp:Label>
                        <%# Container.ItemIndex +1+ (this.pageGrid.CurrentPage-1)*pageGrid.PageSize %>
                    </td>
                    <td class="center">
                        <a class="aEdit" onclick="eidtBox('<%# Eval(FinReceiptMetadata.ColumnNames.BoxID)%>')" title="修改凭证盒" <%# !string.IsNullOrEmpty(Eval(FinBoxMetadata.ColumnNames.BoxNo).ToString())?"Style='display:none'":""%>></a>
                        <a class="aDocument" title="管理凭证" href="SAPFin002b.aspx?BoxId=<%# Eval(FinReceiptMetadata.ColumnNames.BoxID)%>"></a>
                        <a class="aLocation" title="分配仓库号" <%# string.IsNullOrEmpty(Eval(FinBoxMetadata.ColumnNames.BoxNo).ToString())?"Style='display:none'":""%> onclick="Location('<%# Eval(FinBoxMetadata.ColumnNames.BoxID)%>','<%# Eval(FinBoxMetadata.ColumnNames.BoxNo)%>')"></a>
                        <asp:LinkButton ToolTip="删除" runat="server" ID="LinkButtonDelete" CssClass="aDelete" Style='<%#  string.IsNullOrEmpty(Eval(FinBoxMetadata.ColumnNames.BoxNo).ToString())?"": "display:none"%>'
                            OnClientClick="return confirm('是否确定要删除此凭证盒？')" OnCommand="Delete_Command"
                            CommandArgument='<%#Eval(FinBoxMetadata.ColumnNames.BoxID)%>'></asp:LinkButton>
                    </td>
                    <td class="center">
                        <%# Eval("BoxYear")%>-<%#Eval("BoxMonth")%><%#string.IsNullOrEmpty(Eval("BoxMonthEnd").ToString())?"":"~"+Eval("BoxYear").ToString()+"-"+Eval("BoxMonthEnd").ToString()%>
                    </td>
                    <td class="center">
                        <%# Eval("BoxNo")%>
                    </td>
                    <td class="center">
                        <%# Eval("IndexStart")%> - <%# Eval("IndexEnd")%>
                    </td>
                    <td class="center">
                        <%# Eval("DocumentTypeName")%>
                    </td>
                    <td class="center">
                        <%# Eval("CompanyName")%>
                    </td>
                    <td class="center">
                        <%# Eval("CompanyCode")%>
                    </td>
                    <td class="center">
                        <%# Eval("FunctionDeptName")%>
                    </td>
                    <td class="center">
                        <%# Business.getReceiptCount(Eval(FinReceiptMetadata.ColumnNames.BoxID))%>
                    </td>
                    <td class="center">
                        <%# Eval(FinBoxMetadata.ColumnNames.NeedStoreYear)%>
                    </td>
                    <td class="center">
                        <%# Eval("LocationName")%>
                    </td>
                    <td class="center">
                        <%# Eval("StorageStatusName")%>
                    </td>
                    <td class="center">
                        <%# Eval("LoginName")%>
                    </td>
                    <td class="center">
                        <%# Eval("CreatedBy")%> / <%# Eval("UpdatedBy")%>
                    </td>
                    <td class="center">
                        <%# Eval(FinReceiptMetadata.ColumnNames.CreatedDttm).FormatDate(ConstantValue.DateTimeFormat)%>  / <%# Eval(FinReceiptMetadata.ColumnNames.UpdatedDttm).FormatDate(ConstantValue.DateTimeFormat)%>
                    </td>

                </tr>
            </ItemTemplate>
            <FooterTemplate>
                </tbody> </table>
            </FooterTemplate>
        </yncWeb:PagnationGrid>
    </div>
    <script type="text/javascript" src="<%=ResolveUrl("~/Scripts/Controls/chosen.jquery.min.js")%>"></script>
    <script type="text/javascript">
        $(function () {
            $("#<%=drpDocType.ClientID %>").css('width', '212px').css('height', '100px').chosen({
                max_selected_options: 1,
                no_results_text: "No Datas",
                search_contains: true,
                allow_single_deselect: false
            });
        });

        $(function () {
            $("#<%=drpCompany.ClientID %>").css('width', '212px').css('height', '100px').chosen({
                max_selected_options: 1,
                no_results_text: "No Datas",
                search_contains: true,
                allow_single_deselect: false
            });
        });

        function showMsg(msg) {
            alert(msg);
            window.location.href = "SAPFin002.aspx";
        }
    </script>
</asp:Content>

